<?php
/**
 * @Copyright Copyright (C) 2010-2012
 * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
 + Created by:          Webit Solution
 * Company:		Webit Solution
 + Contact:		www.webits.asia, developer@webits.asia
 * Created on:	Mar 21, 2012
 ^
 + Project: 		WRecruit
 * File Name:	views/employer/tmpl/formcompany.php
 ^ 
 * Description: template for form company
 ^ 
 * History:		NONE
 ^ 
 */

defined('_JEXEC') or die('Restricted access');

 global $mainframe;

$editor = & JFactory :: getEditor();
JHTML :: _('behavior.calendar');


 $document =& JFactory::getDocument();
 $document->addStyleSheet('components/com_wrecruit/css/'.$this->config['theme']);
?>  
<?php if ($this->config['offline'] == '1'){ ?>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
	<tr><td valign="top" class="<?php echo $this->theme['title']; ?>" >	<?php echo $this->config['title']; ?></td></tr>
	<tr><td height="25"></td></tr>
	<tr><td class="wrecruitmsg">
		<?php echo $this->config['offline_text']; ?>
	</td></tr>
</table>	
<?php }else{ ?>

<script language="javascript">
function myValidate(f) {
        if (document.formvalidator.isValid(f)) {
                f.check.value='<?php echo JUtility::getToken(); ?>';//send token
        }
        else {
                alert('<?php echo JText::_( 'JS_SOME_VALUES_ARE_NOT_ACCEPTABLE_PLEASE_RETRY');?>');
				return false;
        }
		return true;
}

</script>


<table cellpadding="0" cellspacing="0" border="0" width="100%">
	<tr><td valign="top" class="<?php echo $this->theme['title']; ?>" >	
		<?php echo $this->config['title']; ?>
	</td>
	</tr>
	<tr><td height="23"></td></tr>
	<?php if ($this->config['cur_location'] == 1) {?>
	<tr><td height="0"></td></tr>
	<tr><td class="curloc">
			<?php echo JText::_('JS_CUR_LOC'); ?> : <a href="index.php?option=com_wrecruit&c=wrecruit&view=employer&layout=myfolders&Itemid=<?php echo $this->Itemid; ?>" class="curloclnk"><?php echo JText::_('JS_MY_FOLDERS'); ?></a> > <?php echo JText::_('JS_FOLDERS_INFO'); ?>
	</td></tr>
	<?php } ?>
	<tr><td>
		<?php 
			if (sizeof($this->employerlinks) != 0){
				echo '<div id="toplinks"><ul>';
				foreach($this->employerlinks as $lnk)	{ ?>
					<span <?php if($lnk[2] == 1)echo 'class="first"'; elseif($lnk[2] == -1)echo 'class="last"';  ?>>
						<a href="<?php echo $lnk[0]; ?>"> <?php echo $lnk[1]; ?></a>
					</span>
				<?php }
				echo '<ul></div>';			
			}
		?>
	</td></tr>	
	<tr><td height="3"></td></tr>
	<tr><td class="<?php echo $this->theme['heading']; ?>" align="center">
		<?php echo JText::_('JS_FOLDERS_INFO') ; ?>
	</td></tr>
	<tr><td height="10"></td></tr>
</table>
<?php
if ($this->canaddnewfolder == 1) { // add new Folder, in edit case always 1

?>
<form action="index.php" method="post" name="adminForm" id="adminForm" class="form-validate" onSubmit="return myValidate(this);">
    <table cellpadding="5" cellspacing="0" border="0" width="100%" class="adminform">
		<?php
		if(isset($this->folders)) ;?>
				      <tr>
				        <td width="20%" align="right"><label id="namemsg" for="name"><strong><?php echo JText::_('JS_FOLDER_NAME'); ?></strong></label>&nbsp;<font color="red">*</font></td>
				          <td width="60%"><input class="inputbox required" type="text" name="name" id="name" size="40" maxlength="255" value="<?php if(isset($this->folders)) echo $this->folders->name; ?>" />
				        </td>
				      </tr>
						<?php if ( $this->config['comp_editor'] == '1' ) { ?>
							<tr><td height="10" colspan="2"></td></tr>
							<tr>
								<td colspan="2" valign="top" align="center"><label id="decriptionmsg" for="decription"><strong><?php echo JText::_('JS_DESCRIPTION'); ?></strong></label>&nbsp;<font color="red">*</font></td>
							</tr>
							<tr>
								<td colspan="2" align="center">
								<?php
									$editor =& JFactory::getEditor();
									if(isset($this->folders))
										echo $editor->display('decription', $this->folders->decription, '550', '300', '60', '20', false);
									else
										echo $editor->display('decription', '', '550', '300', '60', '20', false);
								?>	
								</td>
							</tr>
						<?php } else {?>
				       <tr>
				        <td valign="top" align="right"><label id="decriptionmsg" for="decription"><?php echo JText::_('JS_DESCRIPTION'); ?></label>&nbsp;<font color="red">*</font></td>
				        <td>
							<textarea class="inputbox required" name="decription" id="decription" cols="60" rows="5"><?php if(isset($this->folders)) echo $this->folders->decription; ?></textarea>
						</td>
				      </tr>
						<?php } ?>

    <tr>
        <td colspan="2" height="10"></td>
      <tr>
	<tr>
		<td colspan="2" align="center">
                    <input class="button" type="submit" name="submit_app" onclick="return myValidate(f)" value="<?php echo JText::_('JS_SAVE_FOLDER'); ?>" />
		</td>
	</tr>
    </table>


                        <?php if(isset($this->folders)) $curdate = $this->folders->created;
                        else $curdate = date('Y-m-d H:i:s');    ?>
			<input type="hidden" name="created" value="<?php echo $curdate; ?>" />
			<input type="hidden" name="uid" value="<?php echo $this->uid; ?>" />
			<input type="hidden" name="option" value="<?php echo $this->option; ?>" />
			<input type="hidden" name="status" value="<?php echo $this->folders->status; ?>" />
                        <input type="hidden" name="global"  value="1" />
                        <input type="hidden" name="task" value="savefolder" />
			<input type="hidden" name="check" value="" />
			<?php if(isset($this->packagedetail)) echo '<input type="hidden" name="packageid" value="'.$this->packagedetail[0].'" />';?>
			<?php if(isset($this->packagedetail)) echo '<input type="hidden" name="paymenthistoryid" value="'.$this->packagedetail[1].'" />'; ?>
			
		  <input type="hidden" name="Itemid" id="Itemid" value="<?php echo $this->Itemid; ?>" />
                  <input type="hidden" name="id" value="<?php if(isset($this->folders)) echo $this->folders->id; ?>" />
		  
		  

		</form>
<?php
} else{ // can not add new folder
	echo "<strong><font color='red'>".JText::_('JS_FOLDER_LIMIT_EXCEED')." <a href='index.php?option=com_wrecruit&view=employer&layout=packages&Itemid=$this->Itemid'>".JText::_('JS_EMPLOYER_PACKAGES')."</a></font></strong>";
}

}//ol
?>
<div width="100%">
<?php include_once('components/com_wrecruit/views/fr_jscr.php'); ?>
</div>

